-
Notifications
You must be signed in to change notification settings - Fork 107
2-phase attachment upload uses AttachmentUploadDescriptor which allows PUT and custom header passing (includes breaking changes) #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f0b1f90 to
b2441b0
Compare
| attachment = await attachment_store.create_attachment( | ||
| request.params, context | ||
| ) | ||
| await self.store.save_attachment(attachment, context=context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throwing in this breaking cleanup since the upload descriptor change is already breaking.
This makes it so that ChatKitServer is in charge of saving the attachment metadata to the data store, just as it is responsible for self.store.delete_attachment below. No longer forces the attachment store to have access to data store just to save the attachment metadata.
| id: str | ||
| name: str | ||
| mime_type: str | ||
| upload_url: AnyUrl | None = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing for a clean break. The client will continue to support this field from older versions.
chatkit/types.py
Outdated
| """Two-phase upload instructions.""" | ||
|
|
||
| url: AnyUrl | ||
| method: Literal["put", "post"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all caps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sg - updated!
b2441b0 to
24b53f9
Compare
Add
Attachment.upload_descriptorwhich specifies the upload method (post vs. put) and any custom headers to pass along.Breaking:
Attachment.upload_urlAttachmentsCreateReqfor phase 1 of a 2-phase upload, ChatKitServer callsawait self.store.save_attachment(attachment, context=context)after calling attachment_store's create method. Previously it was the responsibility of attachment_store to save the attachment to the data store, which forced the attachment store to have access to / depend on the thread data store.